import { AxiosRequestConfig, AxiosResponse } from "axios"
import { RequestOptions, Result } from "./types"

export abstract class axiosTransform {
  /**
   * @description: 请求成功处理
   */
  transformRequestData?: (res: AxiosResponse<Result>, options: RequestOptions) => any
  // 请求之前拦截器暴露
  requestInterceptors?: (config: AxiosRequestConfig) => AxiosRequestConfig
  //  请求之前拦截器异常处理
  requestInterceptorsCatch?: (error: Error) => void
  // 请求之后的拦截器
  responseInterceptors?: (response: AxiosResponse) => AxiosResponse<any> | Promise<any>
  //  请求之后拦截器异常处理
  responseInterceptorsCatch?: (response: AxiosResponse) => void
}
